import {binder, view, ViewGroup} from "adajs";
import ListsService from "./state.js";

@view({
    className: "lists",
    template: "./template.html",
    style: "./style.scss",
    dataset: {
        service: ListsService
    }
})
class Lists extends ViewGroup {
    oncommited(a) {
        if (a === 'update') {
            this.commit("nextPage");
        }
    }

    @binder("next")
    next() {
        this.commit("showLoading").then(() => this.commit("nextPage"));
    }

    @binder("retry")
    retry() {
        this.commit("showLoading").then(() => this.commit("retry"));
    }
}

export default Lists;